package com.conversationboard.view;

import java.sql.SQLException;
import java.util.List;

import com.conversationboard.model.Board;
import com.conversationboard.model.Boards;
import com.conversationboard.model.User;

public class BoardDisplay {

    public static String displayDropDown(User user) throws SQLException {

        StringBuilder buffer = new StringBuilder();
        List<Board> boards = Boards.getAuthorisedBoards(user, true);

        buffer.append("<select name='board'>");

        buffer.append("<option value=\"0\" />");

        for (Board board : boards) {
            buffer.append("<option value=\"" + board.getBoardId() + "\">" + board.getName() + "</option>");
        }

        buffer.append("</select>");

        return buffer.toString();

    }

}
